#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

const int N = 100001;
int n, m, w, a[N];

bool judge(int x)
{
	int Q[4*N], tmp = m;
	memset(Q, 0, sizeof(Q));
	int head = 0, tail = 0;
	for (int i = 0; i != n; ++i) {
		while (i-Q[head]+1 > w && head < tail) ++head;
		if (x > a[i] + tail - head + tmp) return false;
		while (a[i] + tail - head < x) {
			Q[tail++] = i;
			--tmp;
			if (tmp < 0) return false;
		}
	}
	return true;
}

int main()
{
	int l = 1 << 30, h = 0;
	scanf("%d%d%d", &n, &m, &w);
	for (int i = 0; i != n; ++i) {
		scanf("%d", &a[i]);
		l = min(l, a[i]);
		h = max(h, a[i]);
	}
	h += m;
	while (l + 1 < h) {
		int mid = (l + h) / 2;
		if (judge(mid))
			l = mid;
		else
			h = mid - 1;
	}
	if (judge(h))
		cout << h << endl;
	else
		cout << l << endl;
}
